package com.nbsystem.controller;

import com.nbsystem.entity.SysRolePer;
import com.nbsystem.service.SysRolePerService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SysRolePer)表控制层
 *
 * @author makejava
 * @since 2021-06-07 15:27:06
 */
@RestController
@RequestMapping("sysRolePer")
public class SysRolePerController {
    /**
     * 服务对象
     */
    @Resource
    private SysRolePerService sysRolePerService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public SysRolePer selectOne(Integer id) {
        return this.sysRolePerService.queryById(id);
    }

    @RequestMapping("queryPerRole")
    public List<SysRolePer> queryRolePer(SysRolePer sysRolePer){
        return this.sysRolePerService.queryAll(sysRolePer);
    }

    @RequestMapping("updatePer")
    public String updatePer(Integer roleId, Integer[] perIds){
        sysRolePerService.updatePer(roleId,perIds);
        return "success";
    }

}
